package demo.util;

import com.alibaba.dcm.DnsCacheEntry;
import com.alibaba.dcm.DnsCacheManipulator;
import com.alibaba.fastjson.JSON;
import demo.java.net.HttpDemo;
import org.junit.Test;

import java.io.IOException;
import java.net.InetAddress;

public class DnsTest {

    @Test
    public void testDnsCache() throws IOException {
        String host = "vms.tencentcloudapi.com";
        host = "https://www.taobao.com/";
        HttpDemo.get(host, 2000, 3000);
        DnsCacheEntry dnsCache = DnsCacheManipulator.getDnsCache(host);
        System.out.println(JSON.toJSONString(dnsCache));
        String ip = InetAddress.getByName("www.taobao.com").getHostAddress();
        System.out.println(ip);

    }
}
